From d0f9b588c0e0500272f6d646d36b51f10a1d749e Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Fri, 4 Nov 2005 11:06:41 +0100 Subject: [PATCH] This patch adds a check to make sure the config file passed to vnet-create is correct. This is better than throwing IOError, because IOError's are currently reported as xend communication failures. Also, fix the IOError handling at the end of the file so we don't get a stack dump if that path is taken. Signed-off-by: Dan Smith --- tools/python/xen/xm/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index cec2bef59d..ec4bf16d3a 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -666,6 +666,10 @@ def xm_vnet_list(args): def xm_vnet_create(args): arg_check(args, 1, "vnet-create") conf = args[0] + if not os.access(conf, os.R_OK): + print "File not found: %s" % conf + sys.exit(1) + from xen.xend.XendClient import server server.xend_vnet_create(conf) @@ -800,7 +804,7 @@ def main(argv=sys.argv): except KeyboardInterrupt: print "Interrupted." sys.exit(1) - except IOError: + except IOError, ex: if os.geteuid() != 0: err("Most commands need root access. Please try again as root.") else: -- 2.30.2